import { createRouter, createWebHistory,createWebHashHistory} from 'vue-router'
import { routerning } from "@/router/ning/ning"
import { routergang } from "@/router/gang/gang"
import { routerliwei } from "@/router/liwei/liwei"
import { routerlei } from "@/router/lei/lei"
import { routerbiao } from "@/router/biao/biao"
import { routerwenbo } from "@/router/wenbo/wenbo"

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/index',
      name: 'index',
      component: () => import('../views/index.vue'),
      children:[
         ...routerning,
        ...routergang,
        ...routerliwei,
        ...routerlei,
        ...routerbiao,
        ...routerwenbo,
        
      ]
    },
    {
      path: '/login',
      name: 'login',
      meta: { title: '登录' },
      component: () => import('../views/ning/login.vue'),
    },
    {
      path: '/',
      redirect: '/index/home',
    },
    {
      path: '/:error(.*)', //404路由
      component: ()=>import('../views/notfound/index.vue')
    }
  ]
})

router.beforeEach((to:any,from:any,next:any) => {
  document.title = to.meta.title;//修改网页标题
  next(); 
})


export default router
